/**
* @Author: zmx
* @Date: 2023/9/26
* @Description:
*/
<template>
  <el-dialog :title="'修改任务'" :visible.sync="show" append-to-body width="30%" :before-close="cancel">
    <el-form :inline="true" :model="formInline">
      <el-row>
        <el-form-item label="开始时间：">
          <el-date-picker
            v-model="formInline.startTime"
            type="date"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
            class="curveDate"
            style="width: 200px"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间：">
          <el-date-picker
            v-model="formInline.endTime"
            type="date"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="选择日期"
            class="curveDate"
            style="width: 200px"
          >
          </el-date-picker>
        </el-form-item>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="checkBtn">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import {plan} from '../../api/inspection/apiUntil'
export default {
  props: ['DialogComponentShow','row'],
  data() {
    return {
      show: false,
      formInline: {
        startTime: '',
        endTime:''
      },
    };
  },
  mounted() {
    //显示弹窗
    this.show = this.DialogComponentShow
  },
  methods: {
    cancel(){
      this.show = false
      this.$parent.cancel()
    },
    //关闭弹窗
    handleClose() {
      this.show = false
      this.$emit('closeDialog')
    },
    getResult(res){
      if(res.code===200){
        this.$message({
          message: '修改成功',
          type: 'success'
        });
      }else {
        this.$message({
          message: res.msg,
          type: 'error'
        });
      }
      this.handleClose()
    },
    checkBtn() {
      let param = {
        startTime:this.formInline.startTime,
        endTime:this.formInline.endTime,
        id: this.row.id,
      }
      plan.getTaskUpt(param).then((res)=>{
        this.getResult(res)
      })
    }
  }
};
</script>

<style lang="scss" scoped>
>>> .el-dialog__header{
  padding: 20px !important;
  background: #1B7B87;
}
>>> .el-dialog__title{
  color: #fff !important;
  font-size: 16px;
}
</style>
